package edu.zut.cs.network.exercise.practice.object;

import java.util.ArrayList;
import java.util.List;


public class PhoneManagerImpl implements PhoneManager{

	 List<Phone> list  = new ArrayList<Phone>();
	
	  private void init() {
		  
		  Phone phone1 = new Phone("xiaomi","red",001l,1999);
		  Phone phone2 = new Phone("vivo","white",002l,2799);
		  Phone phone3 = new Phone("oppo","black",003l,2899);
		  
		  list.add(phone1);
		  list.add(phone2);
		  list.add(phone3);
		  
		  
	    }

	    public PhoneManagerImpl() {
	        this.init();
	    }

	
	public List<Phone> getAll() {
		// TODO Auto-generated method stub
		return this.list;
	}
	

	public Phone getMessage(Long Id) {
		// TODO Auto-generated method stub
		for (Phone phone : list) {
			if (Id.equals(phone.getId())) {
               return phone;
               
           }
		}
		return null;
	}
}
